Skip to content

perf(ci): bring the Numeric Ranges job from 5.6 min to about 1 min - #4660

Merged
thymikee merged 2 commits into
mainfrom
ci/numeric-ranges-scope
Nov 18, 2026
Merged

thymikee merged 2 commits into
mainfrom
ci/numeric-ranges-scope

Conversation

@thymikee

@thymikee thymikee commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Summary

The Numeric Ranges gate (fr) classifies every function parameter's declared type before it analyzes a function. src/cli-command-dispatch.test.ts typed its parameters with oxc-parser's Expression union — every AST kind, each a record of further such unions. That one file cost more analysis time than the rest of the repository combined. The reader now declares the node fields it reads.

Check numeric ranges also gets its own timeout-minutes: 3, so a range-analysis regression fails the lane instead of passing as slow green. The job keeps timeout-minutes: 20; a cold install runs in Setup toolchain and cannot trip the step budget.

Check numeric ranges step:

The job falls from 362 s to 87 s. Numeric Ranges is no longer the slowest CI job. Locally, the same command went 146 s → 21 s.

Validation

  • Tested SHA: 90ba157 — run 44177798121 is green across Numeric Ranges, Coverage, Lint/Typecheck/Package, Integration Tests, and Repo Guards.
  • Gate verdict unchanged: fr reports 0 findings and identical project-wide coverage counts before and after; a planted console.assert violation in a production file still fails the gate with exit 1.
  • Test verdict unchanged: the reader collects the same 18 command literals from src/cli.ts, now pinned by a deep-equal. A reader that stops collecting fails it. Renaming a dispatch comparison in src/cli.ts still fails the test.
  • Risks: this file's own per-function detail shifts (two helpers move between "partially supported" and "unsupported"); no finding is gained or lost.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.38 MB 6.38 MB 0 B
Package (unpacked) 6.38 MB 6.38 MB 0 B
Package (download) 1.94 MB 1.94 MB -12 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 28.5 ms 27.3 ms -1.2 ms
CLI --help 57.9 ms 55.3 ms -2.6 ms

@thymikee

Copy link
Copy Markdown
Member Author

Nice work. At 60eb5f2 I found nothing that needs to change, so the code is ready. There are no conflicts, and 17 of 18 checks are green, including Numeric Ranges at 1m20s; only the last check is still queued. The diff touches only the ci.yml comment and timeout plus one test file, so no failing route applies to it. Before merge, mark it ready, fill the PR body TBDs with 60eb5f2 and the measured 54 s step, and let the last check finish.

Not blocking, take or leave: the 5 min job-wide timeout leaves about 4x room over the 77 s job, so a regression of 245-265 s of step time would still pass, and 3 min would match the new baseline better. The ci.yml comment and the AstNode doc block repeat measurement history that will go stale, so a one-line rule is enough there. AstNode is now a hand-written shape of the oxc-parser output, so asserting the exact collected set (about 18 literals) would turn a partial extraction miss red.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apex Sentinel: 1 new finding on 60eb5f2. The verdict and the full list are in the summary comment.

Comment thread .github/workflows/ci.yml Resolved
thymikee and others added 2 commits November 17, 2026 22:14
The range gate classifies every function parameter's declared type before it
analyzes the function, and this file took `oxc-parser`'s whole `Expression`
union as its parameter type. That union is every AST kind, each a record of
further such unions, so one file cost more analysis time than the rest of the
repository combined: `pnpm exec fr` went 146s to 21s on the same machine when
the reader declares the node fields it reads.

The reader's verdict is unchanged, and the test now pins the literal set it
collects: `src/cli.ts` yields 18 command literals, and a reader that stops
collecting fails the deep-equal instead of passing over an empty loop.
`scripts/lib/shipped-imports.ts` already records the same constraint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The audit's cost is per function parameter type, so a parameter typed as a
parser's whole expression union makes one file cost minutes of analysis. The
budget goes on the step rather than the job: a lockfile-changing PR pays a cold
install in Setup toolchain, and that must not decide whether the gate runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the ci/numeric-ranges-scope branch from 60eb5f2 to 90ba157 Compare November 17, 2026 21:14
@thymikee
thymikee marked this pull request as ready for review November 17, 2026 21:15
@thymikee

Copy link
Copy Markdown
Member Author

I found no problems in the code at 90ba157. The job timeout is back to 20 minutes (https://github.com/callstack/agent-device/blob/90ba157/.github/workflows/ci.yml#L279) and the 3-minute budget now sits on the Check numeric ranges step (https://github.com/callstack/agent-device/blob/90ba157/.github/workflows/ci.yml#L291), so checkout and a cold install can no longer trip it. That fixes the earlier timeout concern, and nothing else remains from my side.

The thread on the job timeout covering setup time (#4660 (comment)) no longer applies at this head, so you can resolve it.

There are no conflicts, and the one check still pending is queued, not failed. The diff touches only .github/workflows/ci.yml and src/cli-command-dispatch.test.ts. The earlier Coverage failure (coordinate.contract.test.ts timeout) is in a file this PR does not touch.

The identical coverage counts, the 54 s step timing and the planted-violation check come from the PR body.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 17, 2026
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of 90ba157

Since the review of 60eb5f2: 0 new · 0 still open · 1 no longer raised (1 marked fixed)

No open findings.

Reviewed with this repository's own Sentinel configuration (655ede2796e5).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee
thymikee merged commit 4fcbc67 into main Nov 18, 2026
24 checks passed
@thymikee
thymikee deleted the ci/numeric-ranges-scope branch November 18, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant